package com.fulin.leetcode;

/**
 * TODO
 *
 * @Author fulin
 * @Date 2023/1/31 10:15
 **/
public class Num2319_判断矩阵是否是一个X矩阵 {
    public boolean checkXMatrix(int[][] grid) {
        int len = grid.length;
        for(int l = 0; l < len ;l++){
            for(int h = 0;h < len;h++){
                if(l == h || l + h == len -1){
                    if(grid[l][h] == 0){
                        return false;
                    }
                }else{
                    if(grid[l][h] != 0){
                        return false;
                    }
                }
            }
        }
        return true;
    }
}
